# 指定CMake的最低版本要求
cmake_minimum_required(VERSION 3.30)

# 设置项目名称和支持的语言
project(tpxsdk VERSION 1.0 LANGUAGES CXX)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# PkgConfig 查找路径 (Windows)
set(PKG_CONFIG_EXECUTABLE "D:/GitHub/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe")
set(PKG_CONFIG_ARGN
        "--errors-to-stdout"
        "--no-cache"
        "--log-file=D:/GitHub/vcpkg/pkgconf.log"
        "--with-path=D:/GitHub/vcpkg/packages/ffmpeg_x64-windows/lib/pkgconfig"
        "--with-path=D:/GitHub/vcpkg/packages/gtest_x64-windows/lib/pkgconfig"
        "--path"
)
# PkgConfig 查找路径 (Linux)
find_package(PkgConfig REQUIRED)
find_package(GTest REQUIRED)

# FFMPEG 库的查找路径
pkg_check_modules(AVFORMAT REQUIRED libavformat)
pkg_check_modules(AVCODEC REQUIRED libavcodec)
pkg_check_modules(AVUTIL REQUIRED libavutil)
pkg_check_modules(SWSCALE REQUIRED libswscale)
pkg_check_modules(AVFILTER REQUIRED libavfilter)

# FFMPEG 头文件路径添加到项目
include_directories(
    ${AVFORMAT_INCLUDE_DIRS}
    ${AVCODEC_INCLUDE_DIRS}
    ${AVUTIL_INCLUDE_DIRS}
    ${SWSCALE_INCLUDE_DIRS}
    ${AVFILTER_INCLUDE_DIRS}
)

# FFMPEG 库文件添加到项目
set(FFMPEG_LIBRARIES
    ${AVFORMAT_LIBRARIES}
    ${AVCODEC_LIBRARIES}
    ${AVUTIL_LIBRARIES}
    ${SWSCALE_LIBRARIES}
    ${AVFILTER_LIBRARIES}
)

add_library(tpxsdk)
# 包含SDK目录
add_subdirectory(src)

# 添加生成可执行程序
# add_executable(main.cpp)

# 添加测试目标
# add_subdirectory(test)
enable_testing()
